package state.util;

import java.util.Vector;

import particle.core.tools.HashTableStringToObject;

public class Hashtable extends HashTableStringToObject {
  public Hashtable() {
  }

  public boolean contains(Object value) {
    return containsKey(String.valueOf(value));
  }

  public boolean containsKey(Object key) {
    return containsKey(String.valueOf(key));
  }

  public Vector elements() {
    Vector valueVector = new Vector();
    int index = 0;
    while (index < getSize()) {
      valueVector.add(get(getKey(index)));
      index++;
    }
    return valueVector;
  }

  public Object get(Object key) {
    return getAt(String.valueOf(key));
  }

  public boolean isEmpty() {
    return getSize() == 0;
  }

  public Vector keys() {
    Vector keyVector = new Vector();
    int index = 0;
    while (index < getSize()) {
      keyVector.add(getKey(index));
      index++;
    }
    return keyVector;
  }

  public Object put(Object key, Object value) {
    setAt(String.valueOf(key), value);
    return key;
  }

  public Object remove(Object key) {
    Object value = get(key);
    removeAt(String.valueOf(key));
    return value;
  }

  public int size() {
    return getSize();
  }

  public Vector values() {
    return elements();
  }

  public void clear() {
    removeAll();
  }
}
